package com.qianxun.module.datasource1.admin.rest;


import com.qianxun.module.datasource1.admin.service.SysDataModifyLockService;
import com.qianxun.module.datasource1.admin.service.SysUserMenuRoleRelationService;
import com.qianxun.module.datasource1.admin.util.SysUserUtil;
import com.qianxun.module.base.constant.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


/**
* com.zch.admin.base.entity.SysUserRoleRelation模型http接口处理
*
* @author: admin
* @date: 2019-11-13
* @version: 1.0.0
*/
@RestController
@RequestMapping("/admin/userMenuRoleRelation")
public class SysUserMenuRoleRelationRestController {

    @Resource
    private SysUserMenuRoleRelationService baseService;
    @Resource
    private SysDataModifyLockService sysDataModifyLockService;

    @RequestMapping(value = {"/setAuthority/{userId}"})
    public Result setAuthority(@PathVariable(value = "userId")Long userId , @RequestParam(value = "roleIds") Long[] roleIds ){
        sysDataModifyLockService.checkLocked(SysUserUtil.dataLockKey(userId));

        baseService.setAuthority(userId ,roleIds);
        return Result.success();
    }
}
